home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / advbas26.arc / ADVBAS.DOC next >
Text File  |  1986-09-19  |  56KB  |  2,509 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.                            ADVBAS.LIB v2.6, 9/19/86
  8.  
  9.                Advanced Function Library for the BASIC Compiler
  10.  
  11.                   Copyright (C) Thomas Hanlin III, 1985, 1986
  12.  
  13.  
  14.  
  15.  
  16. Requirements:
  17.  
  18.      An  IBM  PC  or  compatible  with  the IBM BASIC Compiler or the Microsoft
  19. QuickBASIC Compiler.  PC-DOS/MS-DOS versions 2.0 or higher should be used.
  20.  
  21.      The  BASIC  Compiler  is  a  powerful and flexible tool.  However, it suf-
  22. fers  from  a  number of serious limitations.  The early versions were designed
  23. for  DOS  v1,  and  cannot  handle version 2+ functions such as subdirectories;
  24. there  is  little direct access to many advanced DOS features such as selective
  25. screen  scrolling;  and  the  speed  is  not  all that it might be, for all its
  26. improvement  over  interpreted  BASIC.  To reduce these problems, I've designed
  27. a  number  of  assembly  language  routines  which perform desirable functions,
  28. and  put  them  in a library which the compiler can access.  Since I have found
  29. these  functions  to  be  useful,  I  thought I'd pass them on to other people.
  30. You  may  use  ADVBAS functions in any of your programs.  If you do so, I would
  31. appreciate  you  sending  a  contribution  (recommended  amount $25, which will
  32. get  you  a  disk  containing the source code to these routines, an explanation
  33. of  how  BASIC  tokenizes  programs, a crossreference utility, a communications
  34. program  [Eterm]  with  source,  and  lots  more;  registered users may receive
  35. updates  for  $10).   It  would  also  be nice if you acknowledged use of these
  36. routines  in  your  program.   ADVBAS  may  be copied and distributed freely as
  37. long  as  it  and this manual are included unchanged.  The copyright is to pre-
  38. serve  my  options,  and  to  protect  you  from  the untoward modifications of
  39. others.  It is not intended to prevent the free distribution of ADVBAS.
  40.  
  41.      To  use  ADVBAS  functions,  you must copy ADVBAS.LIB to the disk on which
  42. you  keep  your BASIC Compiler library files.  When you compile a program which
  43. uses  an  ADVBAS function, you must specify ADVBAS (preceeded by a drive letter
  44. if  it's  on a different disk than the program you're compiling) when LINK asks
  45. you which libraries to use.  That is, at the LINKer prompt "Libraries [.LIB]:"
  46. you should say "ADVBAS" (without the quotes!).
  47.  
  48.      These  functions  have  not  caused  me any problems, and seem to be fully
  49. debugged;  however,  I  will  not be responsible for any damages caused by use,
  50. misuse,  or  inability to use ADVBAS.  But I'll try my best to fix any problems
  51. you  may  turn  up!  Keep in mind that ADVBAS functions will work only with the
  52. compiler, not the interpreter.
  53.  
  54. Aside from their convenience, these functions:
  55.  
  56.      1) add abilities which are not otherwise available;
  57.      2) are generally faster than the corresponding Compiled BASIC code;
  58.      3) usually take up less space in the resulting EXEcutable file;
  59.      4) often leave you more free programming space.
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.                                 Operation Notes
  74.  
  75.  
  76.  
  77.  
  78. Function Requirements:
  79.  
  80.      Numeric variables used in function calls must be integers unless specified
  81. otherwise.   Either  declare  them  using  DEFINT, or add a percent sign "%" to
  82. the  end  of the variable name.  Strings sometimes must be defined to a certain
  83. minimum  length,  due  to  limitations  on  what  machine language routines are
  84. allowed  to  do  to  strings.   Follow the guidelines for each routine in these
  85. respects, or the program will not work as expected!
  86.  
  87.  
  88. Compatibility:
  89.  
  90.      These  functions  vary  in  what  they  demand of your PC.  Some functions
  91. will  work  only  on IBM PCs or clones, some will work on compatibles, and some
  92. will  work  on  any  MS-DOS  routine.  The compatibility level of each function
  93. is  now  listed,  using the categories CLONE (will work on hardware compatibles
  94. only),  BIOS  (close  compatibles), DOS (any MS-DOS machine), and ANY (hardware
  95. independent).  Be warned that the BASIC Compiler itself does not produce parti-
  96. cularly  compatible  code  (BASIC  video  routines  seem to be BIOS-compatible,
  97. etc).
  98.  
  99. QuickBASIC 2.0:
  100.  
  101.      You  can't  use  ADVBAS  (or any assembly-language routines) with QB2 when
  102. the  compile-to-memory  option is on.  To use ADVBAS, either compile your prog-
  103. rams  using  the  old  "separate  compilation method" (QB manual, page 538), or
  104. set  the  compiler  to  either "Compile to .OBJ module" option.  You can get to
  105. the latter from the QB environment by typing ALT-R, then choosing the
  106. "Compile..."  option,  then  picking  the "Compile to .OBJ module" option.  See
  107. your  QB  reference if you can't figure out how to do this-- for an "intuitive"
  108. environment, the new setup is awfully counterintuitive.
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.      Please  mail  contributions,  suggestions  for additional functions, ques-
  117. tions, comments, etc. to the following address:
  118.  
  119.                                Thomas Hanlin III
  120.                              6812 Sydenstricker Rd
  121.                              Springfield, VA 22152
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.                                Routine Reference
  140.  
  141.  
  142.  
  143.  
  144. Disk:
  145.      DelSub, GetSub, MakeSub, SetSub:  subdirectory handling
  146.      GetDrv, SetDrv:  default drive control
  147.      DrvSpace:  space left on a given drive
  148.      GetFdate, GetFtime, SetFTD, GetFattr, SetFattr:  file info control
  149.      FindFirstF, FindNextF:  read file directory
  150.      GetNameF, GetDateF, GetTimeF, GetAttrF, GetSizeF: file dir control
  151.  
  152. Keyboard:
  153.      GetKey: get one of a list of valid keys
  154.      KeyPress: see if a key has been pressed
  155.  
  156. String:
  157.      Bsq, BusqLen, Busq:  text compression/decompression
  158.      Locase, Upcase:  case conversion
  159.      MultiAnd, MultiOr, MultiXor:  bit manipulations on chars in a string
  160.      Strip, StripRange:  deletion of certain chars from a string
  161.      LRotate, RRotate, Reverse:  reorder chars in a string
  162.      Xlate:  run the chars of a string through a translation table
  163.      Extract:  extract delimited substrings from a string using an index
  164.      Soundex:  return the Soundex code of a string
  165.      Checksum, CRC:  error checking (for telecom and other uses)
  166.  
  167. Array:
  168.      AddMatI, SetMatI:  integer array manipulation
  169.      ReadBitF, WriteBitF:  handle arrays of arbitrary bit length
  170.  
  171. Video:
  172.      DMprint, Mprint, MprintC, Qprint, XQprint:  various print routines
  173.      ClrEol, BkSpace, DelChr, InsChr, MDelChr, MInsChr:  screen control
  174.      Mwindow, Scroll, BkScroll:  window control
  175.      ScrSave, ScrRest, GetLine:  save/restore the contents of a screen
  176.      ScrSaveP, ScrSavePD, ScrRestP, ScrRestPD:  variants on the above
  177.      ReColor: change any screen color to another w/o clearing screen
  178.  
  179. Miscellaneous:
  180.      Any2Dec, Dec2Any:  radix conversion (decimal <--> another base)
  181.      GetDOSv:  get the version number of the MS-DOS being used
  182.      SetComm:  set up any comm port to any baud, without closing communications
  183.      WeekDay:  returns the day of the week, Sunday through Saturday
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.                               Compatibility Chart
  206.  
  207.  
  208.  
  209.  
  210. Works on ANY machine:
  211.  
  212.      ADDMATI,  ANY2DEC,  BSQ,  BUSQ,  BUSQLEN, CHECKSUM, CRC, DEC2ANY, EXTRACT,
  213. GETLINE,  LOCASE,  LROTATE,  MULTIAND,  MULTIOR,  MULTIXOR,  READBITF, REVERSE,
  214. RROTATE, SETMATI, SOUNDEX, STRIP, STRIPRANGE, UPCASE, WRITEBITF, XLATE
  215.  
  216.  
  217.  
  218. Works on DOS compatibles:
  219.  
  220.      DELSUB,  DMPRINT,  DRVSPACE,  FINDFIRSTF,  FINDNEXTF,  GETATTRF, GETDATEF,
  221. GETDOSV,  GETDRV,  GETFATTR,  GETFDATE,  GETFTIME,  GETNAMEF, GETSIZEF, GETSUB,
  222. GETTIMEF, MAKESUB, SETDRV, SETFATTR, SETFTD, SETSUB, WEEKDAY
  223.  
  224.  
  225.  
  226. Works on BIOS compatibles:
  227.  
  228.      BKSCROLL,  BKSPACE,  CLREOL,  GETKEY,  KEYPRESS, MDELCHR, MINSCHR, MPRINT,
  229. MPRINTC, MWINDOW, SCROLL, XMPRINT
  230.  
  231.  
  232.  
  233. Works on CLONEs (hardware compatibles):
  234.  
  235.      DELCHR,  INSCHR,  QPRINT,  RECOLOR, SCRREST, SCRRESTP, SCRRESTPD, SCRSAVE,
  236. SCRSAVEP, SCRSAVEPD, SETCOMM, XQPRINT, XQPRINTD
  237.  
  238.  
  239.  
  240.      Note  that  routines from higher sections will work on machines from lower
  241. sections  (DOS-level  routines  will  work  on BIOS- and CLONE-level machines).
  242. It  doesn't  work  the  other  way around (CLONE-level routines may not work on
  243. a DOS-level machine).
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271. Name: ADDMATI
  272.  
  273. Type: Miscellaneous / ANY
  274.  
  275. Description:
  276.      Adds a scalar (integer) value to the first SIZ elements of an
  277. integer  array.   You can subtract by adding a negative number.  If the results
  278. of the calculation ever go outside integer range (-32768 to 32767), the
  279. overflow flag is set on return.  See SETMATI for more information.
  280.  
  281. Example:
  282.      DEFINT A-Z: OPTION BASE 1: DIM ACK(10000): SIZ=10000
  283.       .
  284.       .
  285.      ADDVAL=-6: ARLOC=VARPTR(ACK(1))
  286.      CALL ADDMATI(ARLOC,SIZ,ADDVAL,OVFLOW)
  287.      IF OVFLOW THEN PRINT"Uh oh, overflowed somewhere..."
  288.      REM  we just subtracted six from each element of the array ACK.
  289.  
  290.  
  291.  
  292.  
  293. Name: ANY2DEC
  294.  
  295. Type: Miscellaneous / ANY
  296.  
  297. Description:
  298.      Converts  a  number  (in  string  form)  from any base (2-35) to a decimal
  299. integer  (base 10).  The number to be converted may be in either signed integer
  300. range  (-32768  to  32767)  or unsigned integer range (0 to 65535).  It is con-
  301. verted to a signed integer, which is the only integer type BASIC supports.
  302.  
  303. Example:
  304.      INPUT"Number, base of number";ANUM$,NBASE
  305.      CALL ANY2DEC(ANUM$,NBASE,DNUM,ERCD)
  306.      IF ERCD THEN PRINT"Bad number!" ELSE PRINT"Decimal: ";DNUM
  307.  
  308.  
  309.  
  310.  
  311. Name: BKSCROLL
  312.  
  313. Type: Video / BIOS
  314.  
  315. Description:
  316.      The  same  as  SCROLL  (q.v.), but scrolls lines in the opposite direction
  317. (Back Scroll).
  318.  
  319. Example:
  320.      CALL BKSCROLL(LEFTCOL,TOPROW,RTCOL,BOTROW,NUMLINES)
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337. Name: BKSPACE
  338.  
  339. Type: Video / BIOS
  340.  
  341. Description:
  342.      Move  cursor  back  one space, destroying the character on the space moved
  343. to.   Will  wrap  from one line to the next higher if necessary.  If at the top
  344. left  corner  of  the screen, no action is performed.  Two arguments return the
  345. new  cursor coordinates, since machine language programs cannot directly change
  346. the BASIC cursor position.
  347.  
  348. Example:
  349.      CALL BKSPACE(COL,ROW) : LOCATE ROW,COL
  350.  
  351.  
  352.  
  353.  
  354. Name: BSQ
  355.  
  356. Type: String / ANY
  357.  
  358. Description:
  359.      Uses  several  techniques to compress blank spaces out of an ASCII string.
  360. Savings  range  from 16% (reliable, for ordinary text) to up around 50% or more
  361. for space-intensive info, such as lines in an assembly source file.  BSQ cannot
  362. handle  more  than 127 spaces in a row on a single line, or lines which contain
  363. ASCII   characters   greater   than   127   (which  are  IBM-specific  graphics
  364. characters).   Do  not  use  BSQ  on  lines which may contain such information!
  365. BSQ  compression  is  designed to produce printable (if odd-looking) text which
  366. you may read/write to ordinary sequential files.
  367.  
  368. Example:
  369.      INPUT"String to squeeze";ST$: CALL BSQ(ST$,SLEN)
  370.      PRINT"Squeezed string: ";LEFT$(ST$,SLEN)
  371.  
  372.  
  373.  
  374.  
  375. Name: BUSQ
  376.  
  377. Type: String / ANY
  378.  
  379. Description:
  380.      Decompresses  a  line  squeezed  by  BSQ.  Use BUSQLEN before this routine
  381. to find out how long the unsqueezed line will be!
  382.  
  383. Example:
  384.      see BUSQLEN
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403. Name: BUSQLEN
  404.  
  405. Type: String / ANY
  406.  
  407. Description:
  408.      Tells  how  long  a  line  squeezed with BSQ will be once it's unsqueezed.
  409. You must use this before unsqueezing the line with BUSQ.
  410.  
  411. Example:
  412.      CALL BUSQLEN(ST$,SLEN)
  413.      IF SLEN<0 THEN line is not squeezed, or got damaged somehow-- exit!
  414.      ELSE UNSQ$=SPACE$(SLEN): CALL BUSQ(ST$,UNSQ$)
  415.  
  416.  
  417.  
  418.  
  419.  
  420.  
  421.  
  422.  
  423.  
  424.  
  425.  
  426.  
  427.  
  428.  
  429.  
  430.  
  431.  
  432.  
  433.  
  434.  
  435.  
  436.  
  437.  
  438.  
  439.  
  440.  
  441.  
  442.  
  443.  
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.  
  469. Name: CHECKSUM
  470.  
  471. Type: Miscellaneous / ANY
  472.  
  473. Description:
  474.      Calculates a checksum for a record.  Can be used with Xmodem or Ymodem.
  475.  
  476. Example:
  477.      CALL CHECKSUM(REC$,CHKSM)
  478.  
  479.  
  480.  
  481.  
  482. Name: CLREOL
  483.  
  484. Type: Video / BIOS
  485.  
  486. Description:
  487.      Clear  from  cursor  position  to  end  of line.  Doesn't move the cursor.
  488. No arguments.
  489.  
  490. Example:
  491.      CALL CLREOL
  492.  
  493.  
  494.  
  495.  
  496. Name: CRC
  497.  
  498. Type: Miscellaneous / ANY
  499.  
  500. Description:
  501.      Calculates  a  cyclical  redundancy check value for a record.  Can be used
  502. with Xmodem CRC or Ymodem CRC.
  503.  
  504. Example:
  505.   Sending a record:
  506.      REC$=REC$+STRING$(2,0) : CALL CRC(REC$,HICRC,LOCRC) :
  507.      MID$(REC$,LEN(REC$)-1,2) = CHR$(HICRC)+CHR$(LOCRC) : send Xmodem record
  508.   Receiving a record:
  509.      CALL CRC(REC$,HICRC,LOCRC) : IF HICRC=0 AND LOCRC=0
  510.           THEN record is fine, save it
  511.           ELSE record is bad, request it to be sent again
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534.  
  535. Name: DEC2ANY
  536.  
  537. Type: Miscellaneous / ANY
  538.  
  539. Description:
  540.      Converts  a  number  from decimal (base 10) to any other base (2-35).  The
  541. number  will  be  converted  to  an unsigned integer (signed range of -32768 to
  542. 32767  is  converted  to  unsigned  range  of  0 to 65535), to conform with the
  543. built-in  BASIC  conversion functions HEX$ and OCT$.  ANUM$ must be initialized
  544. to  the maximum size you expect the resultant number to be; this is recommended
  545. to  be  16  characters,  which  is  the maximum length possible.  The result is
  546. right-justified  in  the  field  you  provide,  so  if you want to keep leading
  547. zeroes, just ignore the actual-length specification ALEN.
  548.  
  549. Example:
  550.      INPUT"Decimal number, to base";DNUM,NBASE
  551.      ANUM$ = STRING$(16,"0"): CALL DEC2ANY(DNUM,NBASE,ANUM$,ALEN)
  552.      IF ALEN<0 THEN PRINT"Bad base or ANUM$ initialized too short"
  553.      ELSE PRINT"Result: ";RIGHT$(ANUM$,ALEN)
  554.  
  555.  
  556.  
  557.  
  558.  
  559.  
  560.  
  561.  
  562.  
  563.  
  564.  
  565.  
  566.  
  567.  
  568.  
  569.  
  570.  
  571.  
  572.  
  573.  
  574.  
  575.  
  576.  
  577.  
  578.  
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591.  
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598.  
  599.  
  600.  
  601. Name: DELCHR
  602.  
  603. Type: Video / CLONE
  604.  
  605. Description:
  606.      Deletes  a character from the specified location on the screen.  The char-
  607. acter  at  that  location  will  disappear,  and all characters to the right of
  608. it  on  the  same  screen  line  will be shifted left one space.  This function
  609. should  work  on either color or monochrome monitors, in either 40 or 80 column
  610. text  modes.   The  first  page only (color monitor) is supported, and graphics
  611. modes won't work.
  612.  
  613. Example:
  614.      COL = POS(0): ROW = CSRLIN: CALL DELCHR(ROW,COL)
  615.  
  616.  
  617.  
  618.  
  619. Name: DELSUB
  620.  
  621. Type: Disk / DOS
  622.  
  623. Description:
  624.      Deletes  a  subdirectory.   Parameters  used  are  the  same as in SETSUB.
  625. Note  that  you  may  not delete a subdirectory if it has any files left in it,
  626. or if it is the main directory, or if it is the current default subdirectory.
  627.  
  628. Example:
  629.      TMP$ = SUB$+CHR$(0): CALL DELSUB(TMP$,ERRCODE)
  630.      IF ERRCODE THEN couldn't delete subdir ELSE subdir deleted
  631.  
  632.  
  633.  
  634.  
  635. Name: DMPRINT
  636.  
  637. Type: Video / DOS
  638.  
  639. Description:
  640.      Displays  a  string  at  the  current cursor position, using DOS calls for
  641. output (so device drivers such as ANSI.SYS will work).  This routine is consid-
  642. erably faster than MPRINT (q.v.), but offers fewer amenities.  Character trans-
  643. lation  is  limited to what DOS provides, meaning that, for instance, Backspace
  644. just  moves  the  cursor back without wiping out the previous character.  Other
  645. control  codes may not be translated as you might hope, either.  Finally, since
  646. DOS  provides  no way of finding the current print position, you have to figure
  647. out  where  the cursor will be yourself if you need it (like other display rou-
  648. tines,  DMPRINT  does not update the BASIC cursor position).  You can gain con-
  649. trol  of  such  things  by  using the ANSI.SYS driver.  See your DOS manual for
  650. more information on that.
  651.  
  652. Example:
  653.      CALL DMPRINT(ST$)
  654.  
  655.  
  656.  
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.  
  665.  
  666.  
  667. Name: DRVSPACE
  668.  
  669. Type: Disk / DOS
  670.  
  671. Description:
  672.      Returns  the  amount  of free space left on a given disk drive.  The drive
  673. string  may  be  any  legal disk drive, or "@" (AT sign) for the default drive,
  674. and  must  be  at  least  one  character long.  An illegal drive or other error
  675. will cause free space to be returned as a negative value.
  676.  
  677. Example:
  678.      DRV$="A:"
  679.       .
  680.       .
  681.      CALL DRVSPACE(DRV$,A,B,C): FREE# = CDBL(A)*CDBL(B)*CDBL(C)
  682.      PRINT"Free space on drive ";DRV$;" is";FREE#;"bytes."
  683.  
  684.  
  685.  
  686.  
  687. Name: EXTRACT
  688.  
  689. Type: String / ANY
  690.  
  691. Description:
  692.      Extracts  a  delimited  substring  from a string given an index.  Requires
  693. a  string  of  any  length,  a  delimiter of length one character, and an index
  694. value  from  1-256;  returns the starting location and length of the substring.
  695. If  the  delimiter  is  null  (an error), the substring length will be returned
  696. as  -1.  If the index value is greater than the number of delimited substrings,
  697. a null substring will be returned.
  698.  
  699. Example:
  700.      ST$="John Doe/15 Maple Rd/Hometown, CA 99199/(300) 111-1111"
  701.      INDEX=2: DELIMITER$="/": CALL EXTRACT(ST$,DELIMITER$,INDEX,START,SLEN)
  702.      PRINT MID$(ST$,START,SLEN)
  703.      REM  This will print the second substring (INDEX=2) of the string
  704.      REM  (ST$) delimited by "/" (DELIMITER$), which in this case will
  705.      REM  be "15 Maple Rd".
  706.  
  707.  
  708.  
  709.  
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730.  
  731.  
  732.  
  733. Name: FINDFIRSTF
  734.  
  735. Type: Disk / DOS
  736.  
  737. Description:
  738.      Given  a  filename  (which  may  contain  the wildcards "*" and "?", and a
  739. drive  and  path  spec  if  you like), this searches the default (or specified)
  740. directory  to  find  the  first matching file.  Further matches can be obtained
  741. through  the  FINDNEXTF  routine (q.v.).  If there is a match, ERCD will return
  742. zero,  otherwise  it  will  return  a positive value (unless you entered a null
  743. filename,  in  which  case ERCD will be -1 to flag an error).  You can retrieve
  744. various  information  about  the  matched  file  via  a number of supplementary
  745. functions: GETNAMEF to get the filename, GETATTRF to get the attribute (there's
  746. a  page  at the end of this document on file attributes), GETDATEF and GETTIMEF
  747. to  get  the date and time, and GETSIZEF to get the file size.  You may specify
  748. a  search  attribute as well: 0 (zero) to match normal files, 2 to match hidden
  749. files,  4  for  system files, and 16 for subdirectories.  Attributes other than
  750. zero  will return normal files as well as the specified type, and you can match
  751. on  more  than  one kind of attribute (for instance, to get all kinds of files,
  752. you'd  use an attribute of 22, or 2+4+16).  You can read the volume label using
  753. an  attribute  of  8,  which  will  return only the volume label... supposedly.
  754. In  actual  practice,  the  read-volume-label routine is not entirely reliable,
  755. so  be  sure  to  check  the attribute of the matched file to make sure that it
  756. is in fact 8.
  757.  
  758.      This  function  can  be  used  to  duplicate the DOS directory command, or
  759. to allow filename wildcards in your program, among other things.
  760.  
  761. Example:
  762.      FIL$=FIL$+CHR$(0): CALL FINDFIRSTF(FIL$,ATTR,ERCD)
  763.      IF ERCD THEN PRINT"No matching files"
  764.  
  765.  
  766.  
  767.  
  768.  
  769.  
  770.  
  771.  
  772.  
  773.  
  774.  
  775.  
  776.  
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786.  
  787.  
  788.  
  789.  
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796.  
  797.  
  798.  
  799. Name: FINDNEXTF
  800.  
  801. Type: Disk / DOS
  802.  
  803. Description:
  804.      This is used after the FINDFIRSTF function (q.v.) in order to find further
  805. matching files.
  806.  
  807. Example:
  808.      CALL FINDNEXTF(ERCD)
  809.      IF ERCD THEN PRINT"No more matching files"
  810.  
  811.  
  812.  
  813.  
  814. Name: GETATTRF
  815.  
  816. Type: Disk / DOS
  817.  
  818. Description:
  819.      Returns  the  actual  attribute  of  a  file  matched  using FINDFIRSTF or
  820. FINDNEXTF.  See the end of this document for information on file attributes.
  821.  
  822. Example:
  823.      REM  use this AFTER calling FINDFIRSTF / FINDNEXTF to initialize
  824.      REM  the appropriate file information!
  825.      CALL GETATTRF(ATTR)
  826.  
  827.  
  828.  
  829.  
  830. Name: GETDATEF
  831.  
  832. Type: Disk / DOS
  833.  
  834. Description:
  835.      Returns  the  date  associated  with  the file matched using FINDFIRSTF or
  836. FINDNEXTF.
  837.  
  838. Example:
  839.      CALL GETDATEF(MONTH,DAY,YEAR)
  840.  
  841.  
  842.  
  843.  
  844.  
  845.  
  846.  
  847.  
  848.  
  849.  
  850.  
  851.  
  852.  
  853.  
  854.  
  855.  
  856.  
  857.  
  858.  
  859.  
  860.  
  861.  
  862.  
  863.  
  864.  
  865. Name: GETDOSV
  866.  
  867. Type: Miscellaneous / DOS
  868.  
  869. Description:
  870.      Gets  MS-DOS  version.   The  major version is returned in the first para-
  871. meter,  the  minor  version  in  the  second (e.g., MS-DOS v. 2.11 would return
  872. MAJ = 2, MIN = 11).
  873.  
  874. Example:
  875.      CALL GETDOSV(MAJ,MIN)
  876.  
  877.  
  878.  
  879.  
  880. Name: GETDRV
  881.  
  882. Type: Disk / DOS
  883.  
  884. Description:
  885.      Returns  the  letter  of  the  default drive.  The drive string must be at
  886. least one character long.
  887.  
  888. Example:
  889.      DRV$="x:" : CALL GETDRV(DRV$)
  890.  
  891.  
  892.  
  893.  
  894. Name: GETFATTR
  895.  
  896. Type: Disk / DOS
  897.  
  898. Description:
  899.      Gets  file  attribute.   See section on file attributes at the end of this
  900. manual.
  901.  
  902. Example:
  903.      FIL$ = FIL$ + CHR$(0): CALL GETFATTR(FIL$,ATR)
  904.  
  905.  
  906.  
  907.  
  908.  
  909.  
  910.  
  911.  
  912.  
  913.  
  914.  
  915.  
  916.  
  917.  
  918.  
  919.  
  920.  
  921.  
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928.  
  929.  
  930.  
  931. Name: GETFDATE
  932.  
  933. Type: Disk / DOS
  934.  
  935. Description:
  936.      GETFDATE  returns  the  file  creation  date, that is, the date you see on
  937. a  file  when  you  get  a DIRectory.  The file name must be terminated with an
  938. ASCII  NUL  character.  If there is an error, such as there being no such file,
  939. the month will be -1.
  940.  
  941. Example:
  942.      FIL$ = "TESTFILE.TXT" + CHR$(0)
  943.      CALL GETFDATE(FIL$,MONTH,DAY,YEAR)
  944.  
  945.  
  946.  
  947.  
  948. Name: GETFTIME
  949.  
  950. Type: Disk / DOS
  951.  
  952. Description:
  953.      This  function  complements  GETFDATE, and returns the file creation time.
  954. The  hour  is in 24-hour (military) format, and will be returned as -1 if there
  955. is  no such file or a bad file name.  The seconds are rounded to the next lower
  956. even  number,  due to the DOS storage format.  The file name must be terminated
  957. with an ASCII zero, or NUL character.
  958.  
  959. Example:
  960.      FIL$ = "ANYFILE.EXT" + CHR$(0)
  961.      CALL GETFTIME(FIL$,HOUR,MINUTE,SECOND)
  962.  
  963.  
  964.  
  965.  
  966.  
  967.  
  968.  
  969.  
  970.  
  971.  
  972.  
  973.  
  974.  
  975.  
  976.  
  977.  
  978.  
  979.  
  980.  
  981.  
  982.  
  983.  
  984.  
  985.  
  986.  
  987.  
  988.  
  989.  
  990.  
  991.  
  992.  
  993.  
  994.  
  995.  
  996.  
  997. Name: GETKEY
  998.  
  999. Type: Keyboard / BIOS
  1000.  
  1001. Description:
  1002.      Waits  until  one  of  a list of keys is pressed, and returns it.  The key
  1003. list  (any  length)  should  be uppercase, and if the length is null, the first
  1004. key  pressed  will  be  returned.   The  key returned will be capitalized.  The
  1005. variable  to return the key in must be at least one character long.  This func-
  1006. tion is designed for returning one of a menu of choices, for example.
  1007.  
  1008. Example:
  1009.      GOODKEYS$="KEY LIST"
  1010.              .
  1011.              .
  1012.      KY$="x": CALL GETKEY(GOODKEYS$,KY$)
  1013.  
  1014.  
  1015.  
  1016.  
  1017. Name: GETLINE
  1018.  
  1019. Type: Video / ANY
  1020.  
  1021. Description:
  1022.      Returns a selected line from a screen saved via SCRSAVE, with the trailing
  1023. spaces removed.  The line string must be at least 80 characters long.
  1024.  
  1025. Example:
  1026.      DEFINT A-Z: OPTION BASE 1: DIM SCR(2000)
  1027.      WHERE=VARPTR(SCR(1)): CALL SCRSAVE(WHERE): CLS
  1028.      LINENR=10: LIN$=SPACE$(80): WHERE=VARPTR(SCR(1))
  1029.      CALL GETLINE(WHERE,LINENR,LIN$,LLEN)
  1030.      PRINT"Line 10 was:": PRINT LEFT$(LIN$,LLEN)
  1031.  
  1032.  
  1033.  
  1034.  
  1035. Name: GETNAMEF
  1036.  
  1037. Type: Disk / DOS
  1038.  
  1039. Description:
  1040.      Returns  the  filename  of the file matched using FINDFIRSTF or FINDNEXTF.
  1041. The  FIL$  string  must  be  initialized  to  at least 12 characters in length.
  1042. The  actual  length  of  FIL$ will be returned in FLEN, which will be -1 if you
  1043. didn't  initialize  FIL$  long enough.  Note that the filename will not contain
  1044. a drive or path spec.
  1045.  
  1046. Example:
  1047.      FIL$ = SPACE$(12): CALL GETNAMEF(FIL$,FLEN): FIL$ = LEFT$(FIL$,FLEN)
  1048.  
  1049.  
  1050.  
  1051.  
  1052.  
  1053.  
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060.  
  1061.  
  1062.  
  1063. Name: GETSIZEF
  1064.  
  1065. Type: Disk / DOS
  1066.  
  1067. Description:
  1068.      Returns  the  size of the file matched via FINDFIRSTF or FINDNEXTF.  Since
  1069. the  file  size  may  be  outside integer bounds, there is some additional code
  1070. you  will  have  to  add  which uses double-precision values (see the example).
  1071. You  can  modify  the example to use single-precision instead, but really large
  1072. file sizes will then lapse into exponential notation.
  1073.  
  1074. Example:
  1075.      CALL GETSIZEF(SIZELOW,SIZEHIGH): SIZELOW# = CDBL(SIZELOW)
  1076.      IF SIZELOW < 0 THEN SIZELOW# = SIZELOW# + 65536#
  1077.      FILESIZE# = SIZELOW# + CDBL(SIZEHIGH) * 65536#
  1078.  
  1079.  
  1080.  
  1081.  
  1082. Name: GETSUB
  1083.  
  1084. Type: Disk / DOS
  1085.  
  1086. Description:
  1087.      Gets the default subdirectory.  The subdirectory string must be 64 charac-
  1088. ters  long,  and  it  is  recommended  that you set it to ASCII zeroes (the NUL
  1089. character).  The length of the subdirectory string is returned as an integer
  1090. value.  Note that the string will NOT be started by a backslash "\" character--
  1091. you should add one if appropriate.
  1092.  
  1093. Example:
  1094.      SUB$ = STRING$(64,0) : CALL GETSUB(SUB$,SLEN) :
  1095.      SUB$ = "\" + LEFT$(SUB$,SLEN)
  1096.  
  1097.  
  1098.  
  1099.  
  1100. Name: GETTIMEF
  1101.  
  1102. Type: Disk / DOS
  1103.  
  1104. Description:
  1105.      Returns  the  time  associated  with  the  file  matched  by FINDFIRSTF or
  1106. FINDNEXTF.  The hour is returned in military (24-hour) format.
  1107.  
  1108. Example:
  1109.      CALL GETTIMEF(HOUR,MINUTE,SECOND)
  1110.  
  1111.  
  1112.  
  1113.  
  1114.  
  1115.  
  1116.  
  1117.  
  1118.  
  1119.  
  1120.  
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126.  
  1127.  
  1128.  
  1129. Name: INSCHR
  1130.  
  1131. Type: Video / CLONE
  1132.  
  1133. Description:
  1134.      Inserts a space at the specified screen location.  The character previous-
  1135. ly  at  that  position and all characters to the right of it on the same screen
  1136. line  will  be  shifted  right  one  space.  Subject to the same limitations as
  1137. DELCHR (q.v.).
  1138.  
  1139. Example:
  1140.      COL = POS(0): ROW = CSRLIN: CALL INSCHR(ROW,COL): PRINT"*";
  1141.  
  1142.  
  1143.  
  1144.  
  1145. Name: KEYPRESS
  1146.  
  1147. Type: Keyboard / BIOS
  1148.  
  1149. Description:
  1150.      Tells  you  whether  a key is waiting in the keyboard buffer (for use with
  1151. INKEY$ routines, etc).  KYHIT is set to -1 if a key is waiting, 0 otherwise.
  1152.  
  1153. Example:
  1154.      100 CALL KEYPRESS(KYHIT):IF KYHIT THEN KY$=INKEY$:GOTO 300 ELSE 100
  1155.  
  1156.  
  1157.  
  1158.  
  1159. Name: LOCASE
  1160.  
  1161. Type: String / ANY
  1162.  
  1163. Description:
  1164.      Converts  a  string  to  all  lowercase.  Leaves non-alphabetic characters
  1165. untouched.  String may be any length.
  1166.  
  1167. Example:
  1168.      MSG$="THis IS a test OF tHe lowercase CONVERTER!"
  1169.                .
  1170.                .
  1171.      CALL LOCASE(MSG$)
  1172.  
  1173.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178.  
  1179.  
  1180.  
  1181.  
  1182.  
  1183.  
  1184.  
  1185.  
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192.  
  1193.  
  1194.  
  1195. Name: LROTATE
  1196.  
  1197. Type: String / ANY
  1198.  
  1199. Description:
  1200.      Rotates  the characters in a string left.  That is, the leftmost character
  1201. is removed, and tacked onto the end of the string.  This is useful for rotating
  1202. queues  and  for  character-graphics animation.  If the string is of length one
  1203. or less, it is returned unchanged.
  1204.  
  1205. Example:
  1206.      ST$ = "12345": CALL LROTATE(ST$)
  1207.      REM  ST$ will end up being "23451"
  1208.  
  1209.  
  1210.  
  1211.  
  1212. Name: MAKESUB
  1213.  
  1214. Type: Disk / DOS
  1215.  
  1216. Description:
  1217.      Makes a subdirectory.  Parameters used are the same as in SETSUB.
  1218.  
  1219. Example:
  1220.      TMP$ = SUB$+CHR$(0): CALL MAKESUB(TMP$,ERRCODE)
  1221.      IF ERRCODE THEN couldn't make subdir ELSE subdir created
  1222.  
  1223.  
  1224.  
  1225.  
  1226. Name: MDELCHR
  1227.  
  1228. Type: Video / BIOS
  1229.  
  1230. Description:
  1231.      Deletes the character at the current cursor position.  It obeys the window
  1232. defined by MWINDOW.  It's more compatible than DELCHR, but much slower.
  1233.        Note  that  this  routine  can  be used to scroll a window left by doing
  1234. an MDELCHR at the first location of each line to be scrolled.  To scroll right,
  1235. do the same using MINSCHR instead.
  1236.  
  1237. Example:
  1238.      CALL MDELCHR
  1239.  
  1240.  
  1241.  
  1242.  
  1243.  
  1244.  
  1245.  
  1246.  
  1247.  
  1248.  
  1249.  
  1250.  
  1251.  
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258.  
  1259.  
  1260.  
  1261. Name: MINSCHR
  1262.  
  1263. Type: Video / BIOS
  1264.  
  1265. Description:
  1266.      Inserts a space at the current cursor position, obeying the window defined
  1267. by MWINDOW.  See notes at MDELCHR.
  1268.  
  1269. Example:
  1270.      CALL MINSCHR
  1271.  
  1272.  
  1273.  
  1274.  
  1275. Name: MPRINTC
  1276.  
  1277. Type: Video / BIOS
  1278.  
  1279. Description:
  1280.      Using  this  function,  you  can  at  last  access  device drivers such as
  1281. ANSI.SYS.   This  is a video output function which goes through MS-DOS function
  1282. calls.   It  prints  a single character to the display.  Advantages: allows use
  1283. of   ANSI.SYS   and   similar   video   drivers,  and  windowing  via  MWINDOW.
  1284. Disadvantages: is slower and takes more memory that the usual PRINT statement.
  1285.  
  1286. Example:
  1287.      CALL MPRINTC(CH$,COL,ROW): LOCATE ROW,COL
  1288.  
  1289.  
  1290.  
  1291.  
  1292. Name: MPRINT
  1293.  
  1294. Type: Video / BIOS
  1295.  
  1296. Description:
  1297.      Same  as  MPRINTC  (q.v.), only it allows you to send an entire string out
  1298. to the display, rather than just a single character.
  1299.  
  1300. Example:
  1301.      CALL MPRINT(ST$,COL,ROW): LOCATE ROW,COL
  1302.  
  1303.  
  1304.  
  1305.  
  1306.  
  1307.  
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316.  
  1317.  
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.  
  1325.  
  1326.  
  1327. Name: MULTIAND
  1328.  
  1329. Type: String / ANY
  1330.  
  1331. Description:
  1332.      This  is  a  flexible  function  with many possible uses.  Every character
  1333. in  a  given  string  is  ANDed  with a value you supply.  One thing this could
  1334. be  used  for is translating Wordstar files to ASCII files, by using a bit mask
  1335. (the  value  that  will  be ANDed with the character) of &H7F, which strips off
  1336. the  high  bit  of  each character.  The string may be any length; the bit mask
  1337. is an integer, with only the low byte in use (value of 0-255).
  1338.  
  1339. Example:
  1340.      ST$ = "" : FOR X=65 TO 70: ST$ = CHR$(X)+CHR$(X+128): NEXT : PRINT ST$
  1341.      BITMASK = &H7F : CALL MULTIAND(ST$,BITMASK) : PRINT ST$
  1342.  
  1343.  
  1344.  
  1345.  
  1346. Name: MULTIOR
  1347.  
  1348. Type: String / ANY
  1349.  
  1350. Description:
  1351.      Does  the  exact  opposite  of  MULTIAND--  instead of stripping off bits,
  1352. it  turns  on  bits.   It ORs instead of ANDs.  One possible use for this would
  1353. be  to  encode  a  text  string by ORing with 128, and later decoding by ANDing
  1354. with  128.   This  would allow you to save the string to disk using text files,
  1355. even  if  the string included control codes.  It won't work right if the string
  1356. has  graphics  characters  (using ExtASCII codes, which are codes from 128-255)
  1357. in it, though.  The parameters are the same as for MULTIAND.
  1358.  
  1359. Example:
  1360.      ST$ = "ABCDE": PRINT ST$: SETBITS = &H80
  1361.      CALL MULTIOR(ST$,SETBITS): PRINT ST$
  1362.  
  1363.  
  1364.  
  1365.  
  1366. Name: MULTIXOR
  1367.  
  1368. Type: String / ANY
  1369.  
  1370. Description:
  1371.      An  exclusive-or  operation  for  strings.  Bits in the string will be set
  1372. only  if they are set in the string byte or mask byte, but not in both of them.
  1373. Note  that  this  can  be used as a "MULTINOT" function by using a mask of &HFF
  1374. or  255.   In  this  case,  all  bits are set in the mask, so the result of the
  1375. XOR  will  be  the  same  as a NOT operation on the string.  Note that XORing a
  1376. string  with  the  same  value  twice  will return the original string-- it can
  1377. thus be used to encode and decode strings.
  1378.  
  1379. Example:
  1380.      CALL MULTIXOR(ST$,MASK)
  1381.  
  1382.  
  1383.  
  1384.  
  1385.  
  1386.  
  1387.  
  1388.  
  1389.  
  1390.  
  1391.  
  1392.  
  1393. Name: MWINDOW
  1394.  
  1395. Type: Video / BIOS
  1396.  
  1397. Description:
  1398.      Sets up a window for the MPRINT and MPRINTC routines.  Windows are defined
  1399. by  their  upper  left  corner  and  lower right corner.  The default window is
  1400. thus  (0,0,80,24),  which  leaves  out  the  bottom line (BASIC's status line).
  1401. To  use  the full screen, call this routine with values (0,0,80,25).  Note that
  1402. the cursor should be positioned inside the window before using MPRINT/MPRINTC.
  1403. Note also that windows should be defined to contain at least two rows.
  1404.  
  1405. Example:
  1406.      LFTCOL = 20: TOPROW = 5: RTCOL = 60: BOTROW = 15
  1407.      CALL MWINDOW(LFTCOL,TOPROW,RTCOL,BOTROW): LOCATE TOPROW,LFTCOL
  1408.      REM  sets up a window in the middle of the screen
  1409.      REM  of 40 cols by 10 rows.
  1410.  
  1411.  
  1412.  
  1413.  
  1414. Name: QPRINT
  1415.  
  1416. Type: Video / CLONE
  1417.  
  1418. Description:
  1419.      This  function  bypasses  the  usual  video  routines, and prints a string
  1420. directly  on  the screen, at a -much- higher speed than the normal PRINT state-
  1421. ment  does.   It  also contains a built-in LOCATE statement, and doesn't affect
  1422. the  cursor  position.   The string may be any length.  Control characters will
  1423. show  up  as  graphics  characters  instead of having their original functions,
  1424. and  the  color/attributes  used  will be the ones already on the screen.  This
  1425. works  for  40  or  80 column displays, monochrome or color.  Display page zero
  1426. will be used (if applicable).
  1427.      Note:  this  function  appeared  in BYTE magazine in a different form, and
  1428. has  been  modified  several  times  since.  It is not solely my creation.  See
  1429. the source code for further information.
  1430.  
  1431. Example:
  1432.      ST$ = "This is a test of fast screen printing"
  1433.      ROW = 10: COL = 20
  1434.      CALL QPRINT(ST$,ROW,COL)
  1435.  
  1436.  
  1437.  
  1438.  
  1439.  
  1440.  
  1441.  
  1442.  
  1443.  
  1444.  
  1445.  
  1446.  
  1447.  
  1448.  
  1449.  
  1450.  
  1451.  
  1452.  
  1453.  
  1454.  
  1455.  
  1456.  
  1457.  
  1458.  
  1459. Name: READBITF
  1460.  
  1461. Type: Miscellaneous / ANY
  1462.  
  1463. Description:
  1464.      Reads  a  word  from  an  array  of  arbitrary bit length, given an index.
  1465. The  words  in  the  array  may be made of one to eight bits.  Indices begin at
  1466. zero and are limited by integer range.  That is up to &HFFFF, subject to memory
  1467. constraints--  the  index is taken to be an unsigned integer value.  This func-
  1468. tion  allows  very memory-efficient storage of arrays of numbers, provided that
  1469. the  numbers are within a restricted range.  The simulated array is held within
  1470. a  normal  integer  array,  which  must be dimensioned large enough to hold all
  1471. of  the  arbitrary-length  words  (will  depend  on bits per word and number of
  1472. words desired).
  1473.  
  1474. Example:
  1475.      OPTION BASE 0: DEFINT A-Z: DIM INTARRAY(50): BITFSIZE=8
  1476.        .
  1477.        .
  1478.      ARRAYLOC=VARPTR(INTARRAY(0))
  1479.      CALL READBITF(ARRAYLOC,NDX,BITFSIZE,VALUE)
  1480.      REM  Returns a value from the array location indexed by NDX,
  1481.      REM  where the array is composed of bytes (8-bit words).
  1482.      REM  See the disk file BITFTEST.BAS in the \SOURCE subdirectory
  1483.      REM  for a working example program (compiled BASIC only!!!)
  1484.  
  1485.  
  1486.  
  1487.  
  1488. Name: RECOLOR
  1489.  
  1490. Type: Video / CLONE
  1491.  
  1492. Description:
  1493.      Takes  everything  on  the  screen that's of a given color and changes its
  1494. color  to  whatever  you  like.   This can be used for special effects, or just
  1495. to  change  the  screen  color  without  having to clear the screen.  This will
  1496. work on either mono or color monitors, in text modes only.  The color attribute
  1497. must  be  defined  from  the foreground and background colors using the formula
  1498. shown below.
  1499.  
  1500. Example:
  1501.      OLDCOLR = (BGNDCOLR AND 7)*16 + FGNDCOLR
  1502.      NEWCOLR = (NEWBGNDCOLR AND 7)*16 + NEWFGNDCOLR
  1503.      CALL RECOLOR(OLDCOLR,NEWCOLR)
  1504.  
  1505.  
  1506.  
  1507.  
  1508.  
  1509.  
  1510.  
  1511.  
  1512.  
  1513.  
  1514.  
  1515.  
  1516.  
  1517.  
  1518.  
  1519.  
  1520.  
  1521.  
  1522.  
  1523.  
  1524.  
  1525. Name: REVERSE
  1526.  
  1527. Type: String / ANY
  1528.  
  1529. Description:
  1530.      Reverses  the  order of characters in a string.  This can be combined with
  1531. the  XLATE  function  and  a  judiciously-designed translation table to provide
  1532. mirror images of strings for character-graphics-based displays.
  1533.  
  1534. Example:
  1535.      MSG$="This is a test": CALL REVERSE(MSG$): PRINT MSG$
  1536.  
  1537.  
  1538.  
  1539.  
  1540. Name: RROTATE
  1541.  
  1542. Type: String / ANY
  1543.  
  1544. Description:
  1545.      Rotates  the  characters  in a string right.  This is the same as LROTATE,
  1546. only in reverse.  See LROTATE for further details.
  1547.  
  1548. Example:
  1549.      ST$ = "12345": CALL RROTATE(ST$)
  1550.      REM  ST$ will end up being "51234"
  1551.  
  1552.  
  1553.  
  1554.  
  1555. Name: SCROLL
  1556.  
  1557. Type: Video / BIOS
  1558.  
  1559. Description:
  1560.      Scrolls any selected portion of the screen as many times as you like
  1561. (1-255,  or  use  0 to clear that part of the screen entirely).  Five arguments
  1562. give  coordinates  (LEFTCOL,TOPROW)  of  the  upper  left corner of the area to
  1563. be  scrolled,  coordinates (RTCOL,BOTROW) of the lower right corner of the area
  1564. to  be  scrolled,  and  the  number  of times to scroll the area.  This routine
  1565. may  be  used  to create windows.  Note that RTCOL must be at least one greater
  1566. than  LEFTCOL  (no  single-line  scrolling,  obviously).   Parameters  are  not
  1567. checked, so be careful not to use illegal screen coordinates.
  1568.  
  1569. Example:
  1570.      CALL SCROLL(LEFTCOL,TOPROW,RTCOL,BOTROW,NUMLINES)
  1571.  
  1572.  
  1573.  
  1574.  
  1575.  
  1576.  
  1577.  
  1578.  
  1579.  
  1580.  
  1581.  
  1582.  
  1583.  
  1584.  
  1585.  
  1586.  
  1587.  
  1588.  
  1589.  
  1590.  
  1591. Name: SCRREST
  1592.  
  1593. Type: Video / CLONE
  1594.  
  1595. Description:
  1596.      Restores  the  screen  display from an image put into an array by SCRSAVE.
  1597. Same requirements and limitations of SCRSAVE.
  1598.  
  1599. Example:
  1600.      WHERE = VARPTR(SCR(1)): CALL SCRREST(WHERE): LOCATE OLDROW,OLDCOL
  1601.  
  1602.  
  1603.  
  1604.  
  1605. Name: SCRSAVE
  1606.  
  1607. Type: Video / CLONE
  1608.  
  1609. Description:
  1610.      Stores  the  current screen display (page 0 only) in an array.  Text modes
  1611. only.   Requires  an  array  of  4000 bytes, and an integer which points to the
  1612. location of the array.  The cursor position is not saved.
  1613.  
  1614. Example:
  1615.      DEFINT A-Z: OPTION BASE 1: DIM SCR(2000)
  1616.       .
  1617.       .
  1618.      WHERE = VARPTR(SCR(1)): CALL SCRSAVE(WHERE)
  1619.      OLDCOL = POS(0) : OLDROW = CSRLIN
  1620.      REM  Dim of 2000 w/ option base 1 gives us 2000 integers, each of
  1621.      REM  which occupy two bytes, giving 4000 bytes of storage space.
  1622.      REM  Note: you can store more than one screen in an array by
  1623.      REM  dimensioning it large enough.  Use WHERE=VARPTR(SCR(2001))
  1624.      REM  to locate the second screen, and so forth.
  1625.  
  1626.  
  1627.  
  1628.  
  1629. Name: SCRRESTP, SCRRESTPD, SCRSAVEP, SCRSAVEPD
  1630.  
  1631. Type: Video / CLONE
  1632.  
  1633. Description:
  1634.      These  functions are variations of SCRREST and SCRSAVE.  All of them allow
  1635. specification  of a page number, for color monitors.  They will save or restore
  1636. text  to a given page.  When used with monochrome monitors, the page specifica-
  1637. tion  should  always  be  zero.   SCRRESTPD and SCRSAVEPD write directly to the
  1638. screen  at  high  speed.   This  will cause "snow" if you have an old or poorly
  1639. designed  color  display  adapter  and  are  writing to the active screen page.
  1640. Under those conditions, you should use SCRRESTP/SCRSAVEP or SCRREST/SCRSAVE.
  1641.  
  1642. Example:
  1643.      WHERE = VARPTR(SCR(1)) : SCRNPAGE = 0
  1644.      CALL SCRRESTP(WHERE,SCRNPAGE) : LOCATE OLDROW,OLDCOL
  1645.  
  1646.  
  1647.  
  1648.  
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654.  
  1655.  
  1656.  
  1657. Name: SETCOMM
  1658.  
  1659. Type: Miscellaneous / CLONE
  1660.  
  1661. Description:
  1662.      Sets  communications  parameters on an opened communications device.  This
  1663. allows  you  to set  the  baud  rate  higher than BASIC normally allows, and to
  1664. change the comm parameters without having to close the comm device.
  1665.      Note  that  BASIC  currently limits access to comm ports one and two.  You
  1666. can  set parms on ports 1-4 using SETCOMM, however.  Hopefully a future release
  1667. of ADVBAS will allow you to use the other two ports if you have them.
  1668.      Why  is  it  bad to have to close the comm device?  Because that will make
  1669. the  DTR  signal  drop,  which  will  cause many modems to drop the carrier and
  1670. lose  your  connection.   In  fact,  for  Hayes-type modems, that's a much more
  1671. reliable way to end communications than using the ATH modem command.
  1672.      If  you  try to set a comm port which does not exist, the port number will
  1673. be  set  to  zero  after  the  call.  If you give illegal parameters elsewhere,
  1674. the  port  will  be set to a default of 300 baud, Even parity, Seven-bit words,
  1675. and One stop bit (any of the parms which were legal will be used).
  1676.  
  1677. Example:
  1678.      OPEN"R",1,"COM1:300,E,7,1,RS,CS,DS"
  1679.      COMMPORT = 1 : BPS = 6 : PARITY = 0 : WORDLENGTH = 8 : STOPBITS = 1
  1680.      CALL SETCOMM(COMMPORT,BPS,PARITY,WORDLENGTH,STOPBITS)
  1681.      REM sets the port to 19200 baud, No parity, 8 bit words, 1 stop bit.
  1682.  
  1683. Settings:
  1684.      COMMPORT  may  be  1  - 2, and will be returned as 0 if the specified port
  1685. doesn't exist.  Four ports are allowed, but you can only access 1 and 2.
  1686.      BPS  ("baud  rate")  is  specified  by a number from 0 - 7.  Use 0 for 300
  1687. bps,  1  for  600, 2 for 1200, 3 for 2400, 4 for 4800, 5 for 9600, 6 for 19200,
  1688. and  7  for  38400 bps.  Whether you can actually get higher speeds will depend
  1689. on the quality of your communications port.
  1690.      PARITY is a number 0-2.  Use 0 for None, 1 for Odd, and 2 for Even.
  1691.      WORDLENGTH is 7 or 8, and STOPBITS is 1 or 2, just as you'd expect.
  1692.  
  1693.  
  1694.  
  1695.  
  1696. Name: SETDRV
  1697.  
  1698. Type: Disk / DOS
  1699.  
  1700. Description:
  1701.      Sets  the  default drive.  The drive string must be at least one character
  1702. long, and start with a letter specifying a disk drive.
  1703.  
  1704. Example:
  1705.      DRV$="B:"
  1706.           .
  1707.           .
  1708.      CALL SETDRV(DRV$)
  1709.  
  1710.  
  1711.  
  1712.  
  1713.  
  1714.  
  1715.  
  1716.  
  1717.  
  1718.  
  1719.  
  1720.  
  1721.  
  1722.  
  1723. Name: SETFATTR
  1724.  
  1725. Type: Disk / DOS
  1726.  
  1727. Description:
  1728.      Sets  file  attribute.   See section on file attributes at the end of this
  1729. manual.
  1730.  
  1731. Example:
  1732.      FIL$ = FIL$ + CHR$(0): CALL SETFATTR(FIL$,ATTR)
  1733.  
  1734.  
  1735.  
  1736.  
  1737. Name: SETFTD
  1738.  
  1739. Type: Disk / DOS
  1740.  
  1741. Description:
  1742.      Sets  file  time/date  stamp.   The filename must be terminated with a NUL
  1743. character.   The  year  may  be  either a four digit or two digit number (e.g.,
  1744. may  be  either  1986 or just 86).  DOS will round the seconds value off to the
  1745. next  lower  even  number.   If there is a problem with the filename, the month
  1746. will be returned as -1.
  1747.  
  1748. Example:
  1749.      FIL$=FIL$+CHR$(0)
  1750.      CALL SETFTD(FIL$,MONTH,DAY,YEAR,HOUR,MINUTE,SECOND)
  1751.  
  1752.  
  1753.  
  1754.  
  1755.  
  1756.  
  1757.  
  1758.  
  1759.  
  1760.  
  1761.  
  1762.  
  1763.  
  1764.  
  1765.  
  1766.  
  1767.  
  1768.  
  1769.  
  1770.  
  1771.  
  1772.  
  1773.  
  1774.  
  1775.  
  1776.  
  1777.  
  1778.  
  1779.  
  1780.  
  1781.  
  1782.  
  1783.  
  1784.  
  1785.  
  1786.  
  1787.  
  1788.  
  1789. Name: SETMATI
  1790.  
  1791. Type: Miscellaneous / ANY
  1792.  
  1793. Description:
  1794.      Sets the first SIZ elements of an integer array to a given (scalar) value,
  1795. INITVAL.   It will work on multi-dimensional arrays, in which case the leftmost
  1796. dimension increments first.  See examples for clarification.
  1797.  
  1798. Example:
  1799.      OPTION BASE 0: DEFINT A-Z: DIM BANANA(9)
  1800.      SIZ=10: INITVAL=-3: ARLOC=VARPTR(BANANA(0))
  1801.      CALL SETMATI(ARLOC,SIZ,INITVAL)
  1802.      REM  we have just initialized all 10 elements of the array to
  1803.      REM  the value -3.
  1804.  
  1805. Example:
  1806.      OPTION BASE 1: DEFINT A-Z: DIM FOO(3,5)
  1807.      SIZ=5: INITVAL=20000: ARLOC=VARPTR(FOO(1,1))
  1808.      CALL SETMATI(ARLOC,SIZ,INITVAL)
  1809.      REM  we have just set the first five elements of the array to
  1810.      REM  20000.  The first five elements are FOO(1,1), FOO(2,1),
  1811.      REM  FOO(3,1), FOO(1,2), FOO(2,2).  If you wanted to initialize
  1812.      REM  the whole array to 20000, you'd set SIZ=3*5 for OPTION BASE 1,
  1813.      REM  or SIZ=(3+1)*(5+1) for OPTION BASE 0, in this case...
  1814.      REM  By changing the first element (in the ARLOC assignment), you
  1815.      REM  can set any part of the array, not just the first elements.
  1816.      REM  See SCRSAVE/SCRREST if you need to clear up that last point.
  1817.  
  1818.  
  1819.  
  1820.  
  1821. Name: SETSUB
  1822.  
  1823. Type: Disk / DOS
  1824.  
  1825. Description:
  1826.      Sets  the  default subdirectory.  The subdirectory string must be at least
  1827. one  character  in  length,  since  it  must  be terminated by a NUL character.
  1828. A  negative  one  will  be returned if there was a problem setting to the given
  1829. subdirectory  (either  it's  not available on the default drive, or a bad name,
  1830. most likely); else zero will be returned if all went well.
  1831.  
  1832. Example:
  1833.      TMP$ = SUB$+CHR$(0): CALL SETSUB(TMP$,ERCD) :
  1834.      IF ERCD THEN bad subdir ELSE new default subdir selected
  1835.  
  1836.  
  1837.  
  1838.  
  1839.  
  1840.  
  1841.  
  1842.  
  1843.  
  1844.  
  1845.  
  1846.  
  1847.  
  1848.  
  1849.  
  1850.  
  1851.  
  1852.  
  1853.  
  1854.  
  1855. Name: SOUNDEX
  1856.  
  1857. Type: String / ANY
  1858.  
  1859. Description:
  1860.      This  routine  returns  the  Soundex  code  for a string you give it.  I'm
  1861. not  sure  who  invented  Soundex,  but it's pretty handy.  The Soundex routine
  1862. takes  a  word  and returns a string which represents what the word sounds like
  1863. in  an  abstract  format.  Similar-sounding words can thus be identified easily
  1864. by  your  program after Soundex processing.  This can be useful in applications
  1865. where  a  person  is  not  sure of the exact spelling of a word/name/city, etc.
  1866. To  use,  put  the  word  in  WORD$, initialize the return string SCODE$ to the
  1867. same  length  as  WORD$, and execute the routine.  SLEN% will return the actual
  1868. length  of  SCODE$, which may vary from zero to the length of WORD$.  If SCODE$
  1869. is  not  as  long  as  WORD$ when the routine is called, SLEN% will be returned
  1870. as  -1  to  flag  an error.  The Soundex code is returned as a series of digits
  1871. in SCODE$, although you can represent this any way you choose in your program.
  1872.  
  1873. Example:
  1874.      WORD$ = "AnyWord": SCODE$=WORD$: CALL SOUNDEX(WORD$,SCODE$,SLEN)
  1875.      PRINT"The Soundex code for ";WORD$;" is ";LEFT$(SCODE$,SLEN);"."
  1876.      REM  Try this routine a few times to get a feel for it.
  1877.  
  1878.  
  1879.  
  1880.  
  1881. Name: STRIP
  1882.  
  1883. Type: String / ANY
  1884.  
  1885. Description:
  1886.      Strips  all  occurrences  of  a given target character from a given source
  1887. string.   The  source  string  may  be any length; the target string must be at
  1888. least  one  character.   The  new  length of the source string will be returned
  1889. as an integer, since external routines may not change the length of BASIC
  1890. strings directly.
  1891.  
  1892. Example:
  1893.      MSG$="12 - 2 =   10"
  1894.           .
  1895.           .
  1896.      CH$=" ": CALL STRIP(MSG$,CH$,MLEN): MSG$ = LEFT$(MSG$,MLEN)
  1897.  
  1898.  
  1899.  
  1900.  
  1901.  
  1902.  
  1903.  
  1904.  
  1905.  
  1906.  
  1907.  
  1908.  
  1909.  
  1910.  
  1911.  
  1912.  
  1913.  
  1914.  
  1915.  
  1916.  
  1917.  
  1918.  
  1919.  
  1920.  
  1921. Name: STRIPRANGE
  1922.  
  1923. Type: String / ANY
  1924.  
  1925. Description:
  1926.      Strips  all  characters  within a given range out of a source string.  The
  1927. source  string  may  be  any  length.  The new length of the source string will
  1928. be returned as an integer.
  1929.  
  1930. Example:
  1931.      MSG$="ALL uppercase letters will be G-O-N-E gone"
  1932.      LO = ASC("A"): HI = ASC("Z")
  1933.      CALL STRIPRANGE(MSG$,LO,HI,MLEN): PRINT LEFT$(MSG$,MLEN)
  1934.  
  1935.  
  1936.  
  1937.  
  1938. Name: UPCASE
  1939.  
  1940. Type: String / ANY
  1941.  
  1942. Description:
  1943.      Converts  a  string  to  all  uppercase.  Leaves non-alphabetic characters
  1944. untouched.  String may be any length.
  1945.  
  1946. Example:
  1947.      MSG$="Four score and seven years ago"
  1948.                .
  1949.                .
  1950.      CALL UPCASE(MSG$)
  1951.  
  1952.  
  1953.  
  1954.  
  1955.  
  1956.  
  1957.  
  1958.  
  1959.  
  1960.  
  1961.  
  1962.  
  1963.  
  1964.  
  1965.  
  1966.  
  1967.  
  1968.  
  1969.  
  1970.  
  1971.  
  1972.  
  1973.  
  1974.  
  1975.  
  1976.  
  1977.  
  1978.  
  1979.  
  1980.  
  1981.  
  1982.  
  1983.  
  1984.  
  1985.  
  1986.  
  1987. Name: WEEKDAY
  1988.  
  1989. Type: Miscellaneous / DOS
  1990.  
  1991. Description:
  1992.      Returns  an  integer  from  1  -  7 indicating the day of the week, Sunday
  1993. through Saturday.  The example routine turns this integer into the week day.
  1994.  
  1995. Example:
  1996.      CALL WEEKDAY(DAY%): DLEN% = VAL(MID$("3346535",DAY,1))
  1997.      DLOC% = ASC(MID$("ADGKQVY",DAY%)): REM  This string MUST be uppercase!
  1998.      PRINT"Today is ";MID$("SunMonTuesWednesThursFriSatur",DLOC%,DLEN%);"day."
  1999.  
  2000.  
  2001.  
  2002.  
  2003. Name: WRITEBITF
  2004.  
  2005. Type: Miscellaneous / ANY
  2006.  
  2007. Description:
  2008.      Allows  a  value  to be written into a given location of a simulated array
  2009. of  words  of  arbitrary  bit  length  (1-8 bits per word).  This goes with the
  2010. READBITF  function  above.   The "BITF" is for Bit Field, because the functions
  2011. work  by  creating  fields  of  arbitrary bit length within what is actually an
  2012. integer array.
  2013.  
  2014. Example:
  2015.      CALL WRITEBITF(ARRAYLOC,INDEX,BITFSIZE,VALUE)
  2016.      REM  See the READBITF function, and check out the BITFTEST.BAS if you
  2017.      REM  have the ADVBAS contributor disk, to better idea of what these
  2018.      REM  functions do.  This function is not for novice programmers!
  2019.  
  2020.  
  2021.  
  2022.  
  2023.  
  2024.  
  2025.  
  2026.  
  2027.  
  2028.  
  2029.  
  2030.  
  2031.  
  2032.  
  2033.  
  2034.  
  2035.  
  2036.  
  2037.  
  2038.  
  2039.  
  2040.  
  2041.  
  2042.  
  2043.  
  2044.  
  2045.  
  2046.  
  2047.  
  2048.  
  2049.  
  2050.  
  2051.  
  2052.  
  2053. Name: XLATE
  2054.  
  2055. Type: String / ANY
  2056.  
  2057. Description:
  2058.      This  function  translates a string, character by character, using a table
  2059. you  supply.   The  character's  ASCII value is used as the index to the table,
  2060. and  the  value  at  that location replaces the character's current value.  The
  2061. character  may  be  one  byte  in  length, in which case it will be translated,
  2062. or  zero  bytes,  in  which  case  nothing will happen.  The translation string
  2063. must  be  256  bytes  long  (remember,  strings may be longer than 255 bytes in
  2064. Compiled BASIC, so this is ok).
  2065.  
  2066. Example:
  2067.     XLT$ = "": FOR X=0 TO 255: XLT$=XLT$+CHR$(X): NEXT
  2068.     MID$(XLT$,1,5) = "ABCDE": CH$ = CHR$(0)
  2069.     CALL XLATE$(CH$,XLT$): PRINT CH$
  2070.     REM  CH$ ends up "A", since the start of the table + zero bytes
  2071.     REM      contains "A".  We add zero bytes, because CH$ was
  2072.     REM      originally equal to CHR$(0).
  2073.  
  2074.  
  2075.  
  2076.  
  2077. Name: XMPRINT
  2078.  
  2079. Type: Video / BIOS
  2080.  
  2081. Description:
  2082.      This  routine  combines the XLATE and MPRINTC functions.  It takes a char-
  2083. acter,  runs it through a translation table, and prints it to the screen unless
  2084. the  translated  value  is  NUL  (ASCII  zero).  If it's NUL, no printing takes
  2085. place.   MS-DOS  calls  are  used for printing, so ANSI.SYS will work.  See the
  2086. XLATE and MPRINTC routines for further information.
  2087.  
  2088. Example:
  2089.      CALL XMPRINT(CH$,XLATE$,COL,ROW): LOCATE ROW,COL
  2090.  
  2091.  
  2092.  
  2093.  
  2094.  
  2095.  
  2096.  
  2097.  
  2098.  
  2099.  
  2100.  
  2101.  
  2102.  
  2103.  
  2104.  
  2105.  
  2106.  
  2107.  
  2108.  
  2109.  
  2110.  
  2111.  
  2112.  
  2113.  
  2114.  
  2115.  
  2116.  
  2117.  
  2118.  
  2119. Name: XQPRINT
  2120.  
  2121. Type: Video / CLONE
  2122.  
  2123. Description:
  2124.      This  function  is  an  extended  version of QPRINT.  It is more flexible,
  2125. and  only  a  trifle slower.  XQPRINT has two advantages over QPRINT: it allows
  2126. you  to  choose  a  color/attribute  to use, and lets you choose a display page
  2127. (color/graphics  adapters  only!).   The  attribute  ATTR  must be set up using
  2128. a  special  formula,  and  the display page is limited to a range of 0-3.  This
  2129. means  that  in  40-column  mode,  the display page used will actually be twice
  2130. the  argument  you  give  the  function, giving you access to 40-column display
  2131. pages  0,2,4,  and  6.   Or  so  the theory goes.  The page argument is ignored
  2132. for monochrome adapters.
  2133.  
  2134. Example:
  2135.      ST$ = "This is a test of fast screen printing"
  2136.      ROW = 10: COL = 20: PAGE = 0
  2137.      ATTR = (BACKGROUNDCOLOR AND 7) * 16 + FOREGROUNDCOLOR
  2138.      CALL XQPRINT(ST$,ROW,COL,ATTR,PAGE)
  2139.  
  2140.  
  2141.  
  2142.  
  2143. Name: XQPRINTD
  2144.  
  2145. Type: Video / CLONE
  2146.  
  2147. Description:
  2148.      This  function  is  identical  to  XQPRINT, with the one exception that it
  2149. writes directly to the screen.  That makes it even faster than XQPRINT, but
  2150. means  that  it  will  cause  snow  on some color monitors when printing to the
  2151. active display page.
  2152.  
  2153.  
  2154.  
  2155.  
  2156.  
  2157.  
  2158.  
  2159.  
  2160.  
  2161.  
  2162.  
  2163.  
  2164.  
  2165.  
  2166.  
  2167.  
  2168.  
  2169.  
  2170.  
  2171.  
  2172.  
  2173.  
  2174.  
  2175.  
  2176.  
  2177.  
  2178.  
  2179.  
  2180.  
  2181.  
  2182.  
  2183.  
  2184.  
  2185.                                 File Attributes
  2186.  
  2187.  
  2188.  
  2189.  
  2190.      Every  file  has an "attribute byte" which tells something about the file.
  2191. This  can  be  modified  to  some  extent.   For instance, any file can be made
  2192. "hidden",  in  which  case  it will be invisible; this includes subdirectories,
  2193. which  can  still be used even if you can't see that they're there.  Some kinds
  2194. of  changes  are  not  possible,  however: you can't change a subdirectory into
  2195. a normal file, for example.
  2196.  
  2197.  
  2198. Attribute      Code      Description
  2199.  
  2200. Normal         00h       A normal file.
  2201. Read-only      01h       File can be renamed, but not killed or modified.
  2202. Hidden         02h       File disappears from directory, can't be opened.
  2203. System         04h       Like HIDDEN.  Used for system (DOS, BIOS) files.
  2204. Volume-ID      08h       A disk's volume id.  Can only be one, in root dir.
  2205. Directory      10h       Subdirectory.  Can't be changed to another attribute.
  2206. Archive        20h       Usually set.  Sometimes used for hard disk backup.
  2207.  
  2208.  
  2209.      Combinations  of the codes are possible, as I've mentioned.  For instance,
  2210. a  hidden  subdirectory  would  have  a code of 12h.  A normal file, because of
  2211. the  archive  bit,  might show up as either 00h or 20h... and so on.  Note this
  2212. is  all  in  hexadecimal,  hence  the  "h" postfix.  Convert to decimal form as
  2213. necessary  when  calling  routines  which  use  the  file attribute.  BASIC has
  2214. functions  to  handle  this  for you if you don't understand hex-- see the HEX$
  2215. function and &H prefix in your BASIC manual.
  2216.  
  2217.  
  2218.  
  2219.  
  2220.  
  2221.  
  2222.  
  2223.  
  2224.  
  2225.  
  2226.  
  2227.  
  2228.  
  2229.  
  2230.  
  2231.  
  2232.  
  2233.  
  2234.  
  2235.  
  2236.  
  2237.  
  2238.  
  2239.  
  2240.  
  2241.  
  2242.  
  2243.  
  2244.  
  2245.  
  2246.  
  2247.  
  2248.  
  2249.  
  2250.  
  2251.                                   BASCOM Bugs
  2252.                           (info unrelated to ADVBAS!)
  2253.  
  2254.  
  2255.  
  2256.      Following  are  a  few  notes  on  BASIC Compiler bugs that I've run into.
  2257. These  are  not  caused  by  the ADVBAS routines, and have no relation to them.
  2258. I  just  thought  it might be helpful if I mentioned them, since anyone reading
  2259. this evidently has, or is considering buying, a BASIC Compiler.
  2260.  
  2261. IBM BASIC Compiler v1.00 (may well not apply to the current version 2):
  2262.  
  2263.      Illegal  file  names  return  a  "Bad  file number" error, rather than the
  2264. expected "Bad file name".
  2265.  
  2266.      The  control  codes  to  move the cursor left and right work fine, but not
  2267. the ones to move it up and down, which do nothing.
  2268.  
  2269.      Register  BP  is not saved by the compiler when it does a CALL.  This must
  2270. be  done  by  the  called  routine, since this register is used by the compiler
  2271. for vital information.
  2272.  
  2273.      The  /E compiler option seems to introduce errors into some programs which
  2274. crash  them  by freezing the computer or giving a "String Space Corrupt" error.
  2275. If  this  happens,  I've found you can fix it by adding the /D option, or using
  2276. /X  instead  of  /E.   The latter method cuts down heavily on available program
  2277. space,  so  it  may  not  be as good as the former.  Both add a fair bit to the
  2278. EXE  program  size.   It's a hard life...  This problem may also cause programs
  2279. compiled  without  the  /O  option to lock up, which can't be fixed by using /X
  2280. or /D.  Use the /O option if this happens.
  2281.  
  2282.  
  2283.  
  2284.  
  2285.  
  2286.  
  2287.  
  2288.  
  2289.  
  2290.  
  2291.  
  2292.  
  2293.  
  2294.  
  2295.  
  2296.  
  2297.  
  2298.  
  2299.  
  2300.  
  2301.  
  2302.  
  2303.  
  2304.  
  2305.  
  2306.  
  2307.  
  2308.  
  2309.  
  2310.  
  2311.  
  2312.  
  2313.  
  2314.  
  2315.  
  2316.  
  2317.                                   BASCOM Bugs
  2318.  
  2319.  
  2320.  
  2321. Microsoft QuickBASIC Compiler v1.00:
  2322.  
  2323.      If  there  is not enough memory when you try to execute the SHELL command,
  2324. your  program  will crash.  There is no way to avoid this using error trapping,
  2325. because  the  memory  reallocation  will  have fried the stack.  So even if you
  2326. trap  the  OUT  OF MEMORY error, you'll still crash with a RETURN WITHOUT GOSUB
  2327. if  you  try  to return from a subroutine, or a STRING SPACE CORRUPT error when
  2328. the  compiler  gets  around  to  doing  a string garbage collection.  Bad news.
  2329. It would be nice if it tried to check to see if there was enough memory first.
  2330.  
  2331.      The error STRING FORMULA TOO COMPLEX appears erratically in some programs,
  2332. even  with  the  simplest possible string formulae (like V$="TEST").  This only
  2333. seems  to  happen  in  programs  which  do  a lot of string manipulation, which
  2334. suggests  that  the compiler has a flaky and is doing something wrong with gar-
  2335. bage  collection,  or  something  like  that.   There seems to be no way to get
  2336. around  this bug either-- also bad news.  If you have this problem, I recommend
  2337. that you complain vociferously to Microsoft!
  2338.  
  2339.  
  2340. Microsoft QuickBASIC Compiler v1.02:
  2341.  
  2342.      I  haven't  had a chance to test it out much yet, but they claim that this
  2343. release  solves  the  SHELL  crash  problem.  Also, more control characters are
  2344. now  printed  out  just  like  BASICA.   Many  miscellaneous problems have been
  2345. fixed...          But not the infamous STRING FORMULA TOO COMPLEX error.  Sigh.
  2346.  
  2347.  
  2348.  
  2349.  
  2350.  
  2351.  
  2352.  
  2353.  
  2354.  
  2355.  
  2356.  
  2357.  
  2358.  
  2359.  
  2360.  
  2361.  
  2362.  
  2363.  
  2364.  
  2365.  
  2366.  
  2367.  
  2368.  
  2369.  
  2370.  
  2371.  
  2372.  
  2373.  
  2374.  
  2375.  
  2376.  
  2377.  
  2378.  
  2379.  
  2380.  
  2381.  
  2382.  
  2383.                                   BASCOM Bugs
  2384.  
  2385.  
  2386.  
  2387. Microsoft QuickBASIC Compiler v2.00:
  2388.  
  2389.      Well,  this  release  fixes  yet  more  compiler bugs.  The STRING FORMULA
  2390. TOO  COMPLEX  error  lives  on,  however.  I'm going to have to track that down
  2391. and  send  in  an  example program to Microsoft, I guess, as soon as I can find
  2392. the  time.   A few new functions have been added, but nothing particularly use-
  2393. ful.   The  new  programming environment (a la Turbo Pascal) is poorly designed
  2394. for  an  environment  which is evidently supposed to mimic the "intuitive" feel
  2395. of  the MacIntosh.  The editor really isn't adequate, and suffers from a number
  2396. of  irritating  bugs.   The  compiler  is now a massive 180K, and takes forever
  2397. to  load.   The "user library" feature is fairly worthless-- you can only build
  2398. libraries  of  BASIC  subprograms  with it, not assembly code; you are required
  2399. to  list  all the names of all the subprograms in a library whenever you modify
  2400. the  library;  and  the user library is in its own unique format, so if you had
  2401. hoped  to  be  able  to link it with other languages, forget it.  The one thing
  2402. that  is  good  about  the  new version of the compiler is the manual, which is
  2403. really excellent-- enormous, clear and detailed.
  2404.  
  2405.      Screen  paging  is  doesn't  work.   Assembly routines (like ADVBAS) can't
  2406. be  used  in  the  normal  mode (they generate "UNRESOLVED SUBPROGRAM" errors).
  2407. See  the  notes  at  the  beginning of this document for how to get around that
  2408. problem.   The  editor  has a defective search-and-replace function, adds blank
  2409. lines  at  the  end  of the program under certain conditions, and allows you to
  2410. put some control characters directly into the program (which gives the compiler
  2411. odd  problems).   When  entering  the filename, you have to use Shift-Backspace
  2412. instead of the Delete key to delete characters.  The use of TAB, SPACE, RETURN,
  2413. and  the  arrow  keys  when  making  a choice on the menus is arbitrary, weird,
  2414. and  counterintuitive  in the extreme.  If you use the old method of compiling,
  2415. bypassing  the  new  environment,  you  no  longer get any error messages, just
  2416. an error count.  You can't get a source listing any more, either.
  2417.  
  2418.  
  2419.  
  2420. Wish list for QuickBASIC:
  2421.  
  2422.      Recursive functions.
  2423.      No bugs!
  2424.      Production of code which can be linked with other languages.
  2425.      A  smaller  compiler  (take  out  the  new environment and editor, please,
  2426. and put the error messages back!).
  2427.      An  error  trapping  function  that returns the label of the routine where
  2428. the error took place (like ERL, only for labels).
  2429.      Communications  functions  which  don't  produce  errors  whenever you get
  2430. the slightest bit of line noise.
  2431.  
  2432.  
  2433.  
  2434.  
  2435.  
  2436.  
  2437.  
  2438.  
  2439.  
  2440.  
  2441.  
  2442.  
  2443.  
  2444.  
  2445.  
  2446.  
  2447.  
  2448.  
  2449.                                   BASIC Bugs
  2450.  
  2451.  
  2452.  
  2453.  
  2454.      This  is  a  peculiar  one... it  seems that BASIC can create files having
  2455. names  which  contain  blank  spaces.  This is a problem, because DOS considers
  2456. the  space  to  be a delimiter, and thus cannot handle these files.  Such files
  2457. will not be listed correctly in the directory, and will be impossible to manipu-
  2458. late  from  DOS  (can't  read,  delete,  or otherwise handle the file).  So, be
  2459. careful  to  screen  out  spaces  when  creating files from BASIC!  This caveat
  2460. also  applies  to  subdirectories,  including  those  created  with the MAKESUB
  2461. routine of ADVBAS.
  2462.  
  2463.  
  2464.  
  2465. Call for help:
  2466.  
  2467.      If  you  find  any  other  bugs in any IBM/Microsoft BASIC compiler, or in
  2468. ADVBAS  for  that  matter,  please  let me know.  If I can't fix it, at least I
  2469. can warn people!
  2470.  
  2471.  
  2472.  
  2473.  
  2474.  
  2475.  
  2476.  
  2477.  
  2478.  
  2479.  
  2480.  
  2481.  
  2482.  
  2483.  
  2484.  
  2485.  
  2486.  
  2487.  
  2488.  
  2489.  
  2490.  
  2491.  
  2492.  
  2493.  
  2494.  
  2495.  
  2496.  
  2497.  
  2498.  
  2499.  
  2500.  
  2501.  
  2502.  
  2503.  
  2504.  
  2505.  
  2506.  
  2507.  
  2508.  
  2509.